package com.example.a2209_shop.fgViewModel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.UpdateIconEntityResult
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch
import okhttp3.MultipartBody

class MineViewModel:BaseViewModel() {
    val updateIconSuccess = MutableLiveData<UpdateIconEntityResult>()
    val updateIconFail = MutableLiveData<String>()

    fun updateIcon(part:MultipartBody.Part){
        viewModelScope.launch {
            try {
                updateIconSuccess.value = apiServer.updateIcon(part)
            }catch (e:Exception){
                updateIconFail.value = e.message
            }
        }
    }
}